﻿Imports OpenTK
Public Module ModelData
    Enum IllumTypes
        COLORNOAMBIENT = 0
        COLORAMBIENT = 1
        HIGHLIGHT = 2
        REFLECTRT = 3
        GLASSRT = 4
        FRESNRT = 5
        REFLRTNOFRES = 6
        REFLRTFRES = 7
        REFLNORT = 8
        GLASSNORT = 9
        SHADOWINV = 10
    End Enum
    Enum Cols
        AMBIENT = 0
        DIFFUSE = 1
        EMISSIVE = 2
        SPECULAR = 3
    End Enum
    Structure PickableVert
        Dim x As Double
        Dim y As Double
        Dim z As Double

        Dim PickCol() As Double
    End Structure
    Structure Face
        Dim V1 As UInteger
        Dim V2 As UInteger
        Dim V3 As UInteger

        Dim uV1 As UInteger
        Dim uV2 As UInteger
        Dim uV3 As UInteger

        Dim nV1 As UInteger
        Dim nV2 As UInteger
        Dim nV3 As UInteger

        Dim PickCol() As Double
    End Structure
    Structure RawTexture
        Dim Data() As Byte
        Dim bpp As Integer
        Dim width As Integer
        Dim height As Integer
    End Structure
    Structure Group
        Dim skip As Boolean
        Dim PickCol() As Byte
        Dim arbCol() As Double
        Dim fCnt As Integer
        Dim Faces() As Face
        Dim grpId As String
        Dim matInd As Integer
        Dim matName As String
        Dim spec As Boolean
        Dim SelectedFaces As ArrayList
    End Structure
    Structure Material
        Sub New(ByVal name As String)
            mtlId = name
            texID = -1
            texFile = ""
            ambientCol = New Double() {1, 1, 1, 1}
            diffuseCol = New Double() {1, 1, 1, 1}
            emissiveCol = New Double() {1, 1, 1, 1}
            specularCol = New Double() {1, 1, 1, 1}
        End Sub
        Dim mtlId As String
        Dim texFile As String
        Dim texID As Integer
        Dim illum As IllumTypes
        Dim dissolve As Double
        Dim specular As Double
        Dim optdensity As Double
        Dim texCol As Cols
        Dim trans() As Double
        Dim ambientCol() As Double
        Dim diffuseCol() As Double
        Dim emissiveCol() As Double
        Dim specularCol() As Double
    End Structure
    Structure Model3D
        Dim PickCol() As Double
        Dim Vertices() As PickableVert
        Dim TexCoords() As Vector2d
        Dim Normals() As Vector3d
        Dim Parts() As Group
        Dim Materials() As Material
        Dim SelectedVerts As ArrayList
        Dim SelectedParts As ArrayList
        Dim MatCnt As Integer
        Dim PartCnt As Integer
        Dim VertCnt As Integer
        Dim NormCnt As Integer
    End Structure


    Public Function locatemat(ByVal Mats() As Material, ByVal name As String) As Integer
        For i As Integer = 0 To Mats.Length - 1
            If Mats(i).mtlId.Contains(name) Then Return i
        Next
        Return -1
    End Function
End Module

